﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.ComponentModel;

namespace TorchLightSettings
{
    public class KeyBindingButton : System.Windows.Forms.Button, INotifyPropertyChanged
    {
        private int _keyCode;

        public event PropertyChangedEventHandler PropertyChanged;

        public int KeyCode 
        {
            get { return _keyCode; }
            set
            {
                KeysConverter kc = new KeysConverter();
                base.Text = kc.ConvertToString(value);
                _keyCode = value;
                NotifyPropertyChanged("KeyCode");
            }
        }

        public void NotifyPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        protected override void OnKeyUp(KeyEventArgs kevent)
        {            
            //base.OnKeyUp(kevent);
        }

    }
}
